package com.smz.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smz.entity.TProductOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TProductOrderDAO extends BaseMapper<TProductOrder> {


    /**
     * ggy
     * 查询TProductOrder未发货的订单
     * @return
     */
    List<TProductOrder> selectTProductOrderGgy(@Param("current") Integer current,@Param("rows") Integer rows);
    /**
     *  查询所有订单和其中商品的种类，生产线，产品名称
     * @param page
     * @return
     */
    String str = "SELECT po.*,com.p_enterprise,com.p_name,pl.production_name from t_product_order po LEFT JOIN\n" +
            " commodity com on com.id = po.product_id  left join\n" +
            "t_production_line pl on po.product_line_id=pl.id  LEFT JOIN t_printer on po.printer=t_printer.p_num";


    @Select(str)
    List<TProductOrder> selectProductEnterprise(Page<TProductOrder> page);

    @Select(str+ " where order_id like  CONCAT(#{orderId},'%')")
    List<TProductOrder> selectProductDesign(Integer orderId);

    @Select(str + " where product_status in (#{type},#{typeStr})")
    List<TProductOrder> selectDoneOrReady(Page<TProductOrder> page, @Param("type")String type,@Param("typeStr")String typeStr);

    List<TProductOrder> selectAllOrders();

    TProductOrder selectOrderById(Integer id);


}
